#pragma once

#include "controlcenter_global.h"
#include <osg/ref_ptr>
#include "MainManipulator.h"

namespace osg
{
	class Camera;
}

namespace ControlCenter
{
	class CONTROLCENTER_EXPORT SimpleEditMoveManipulator: public MainManipulator
	{
	public:
		SimpleEditMoveManipulator(osg::Camera* maincamera);
		void setMainCamera(osg::Camera* camera)
		{
			_mainCamera = camera;
		}
		virtual void mouseClick(const osgGA::GUIEventAdapter* ea0,const osgGA::GUIEventAdapter* ea1,
			const osgGA::GUIEventAdapter* key0,const osgGA::GUIEventAdapter* key1);
		virtual void mouseRelease(const osgGA::GUIEventAdapter* ea0,const osgGA::GUIEventAdapter* ea1,
			const osgGA::GUIEventAdapter* key0,const osgGA::GUIEventAdapter* key1);
		virtual void mouseDrag(const osgGA::GUIEventAdapter* ea0,const osgGA::GUIEventAdapter* ea1,
			const osgGA::GUIEventAdapter* key0,const osgGA::GUIEventAdapter* key1);
		virtual void mouseMove(const osgGA::GUIEventAdapter* ea0,const osgGA::GUIEventAdapter* ea1);
		virtual void setToolAction(ActionData* action);
	protected:
		virtual ~SimpleEditMoveManipulator();
		osg::Vec3 getWorldPos(float x,float y);
		void clearCreateObjectsVector();
		void setCloneObjectsAtMousePos(QVector<osg::ref_ptr<CoreBase::ActorBase>> selectobjects,const osg::Vec3& mousepos);
	private:
		osg::Camera*										_mainCamera;
		osg::Vec3											_mouseCurrentpos;
		osg::Vec3											_mouseStartPos;
		QVector<osg::Vec3>									_moveObjectsStartPos;
		QVector<osg::ref_ptr<CoreBase::ActorBase>>			_createObjectsVector;
		int													_mouseMoveX;
		int													_mouseMoveY;
		osg::Vec3											_alignVec;
	};
}